
from ui.cli_progress import printProgressBar
from src.utils import *

import argparse

def parse_arguments(rosen):
    parser = argparse.ArgumentParser(description="Rosen: YouTube/Invidious client.",
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument("-iv",  "--video",          help="play video by url"                                )
    parser.add_argument("-c",   "--channel",        help="display channel videos by url"                    )  
    parser.add_argument("-s",   "--stats",          help="display watched videos stats", action="store_true")
    parser.add_argument("-v",   "--version",        help="display version",              action="store_true")
    
    #for plugin in rosen.plugman.plugins:
    #    if plugin.flag_action != "":
    #        parser.add_argument(plugin.flag, plugin.full_flag, help=plugin.flag_help, action=plugin.flag_action)
    #    else: parser.add_argument(plugin.flag, plugin.full_flag, help=plugin.flag_help)

    args = parser.parse_args()

    if args.video != None: rosen.load_video(args.video)
    elif args.channel != None: rosen.display_channel(0, channelUrl=args.channel)
    elif args.stats != False: 
        rosen.print_stats(); exit(0)
    elif args.version != False:
        rosen.print_version(); exit(0)

